<?php /* SVN: $Id: $ */ ?>
<?php
	if(!empty($this->request->params['isAjax'])):
		echo $this->element('flash_message');
	endif;
?>
<style>
.nganluong-block{
	background: url("<?php echo Router::url('/img/user-sprite.png')?>") no-repeat left -7646px !important;
	height:80px !important;
	width:150px !important;
}
</style> 
<div class="payments order user-profile-form payment-block js-responses js-main-order-block">
<div class="l-curve-top">							
		<div class="r-curve-top">
				<div class="top-bg"></div>
		</div>
						</div>
						<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
								<div class="shad-bg">
								<div class="pay-pledge">
	<h3 class="pledge-now"><?php echo __l('Pledge Now');?></h3>




<div class="l-curve-top">
		<div class="r-curve-top">
				<div class="top-bg"></div>
		</div>
</div>

	<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
	<div class="clearfix pledge-pay">

			<div class="pledge-img grid_left">
				<p>
					<?php 
						echo $this->Html->link($this->Html->showImage('Project', $itemDetail['Project']['Attachment'], array('dimension' => 'big_thumb', 'alt' => sprintf(__l('[Image: %s]'), $this->Html->cText($itemDetail['Project']['name'], false)), 'title' => $this->Html->cText($itemDetail['Project']['name'], false)),array('aspect_ratio'=>1)), array('controller' => 'projects', 'action' => 'view',  $itemDetail['Project']['slug'], 'admin' => false), array('escape' => false));
					?>
				</p>

			</div>
			<div class="pledge-amount project-left grid_17 omega">
			<div class="side1-info-r ">
				<h3>
					<?php echo $this->Html->link($this->Html->cText($itemDetail['Project']['name'],false),array('controller' => 'projects', 'action' => 'view',  $itemDetail['Project']['slug'], 'admin' => false), array('escape' => false));?>
				</h3>
						<p> <?php echo __l('by') . ' '; ?><?php echo $this->Html->link($this->Html->cText($itemDetail['Project']['User']['username']), array('controller' => 'users', 'action' => 'view', $itemDetail['Project']['User']['username']), array('escape' => false));?></p>
					<p class="funding-ends"><?php echo __l('Funding ends ').$this->Time->cDate($itemDetail['Project']['project_funding_end_date']); ?></p>
			</div>
			<?php  $collected_percentage = ($itemDetail['Project']['collected_percentage']) ? $itemDetail['Project']['collected_percentage'] : 0; ?>
				<div class="progress-block round-5  project-left">
					<p class="progress-bar" title = '<?php echo $this->Html->cFloat($collected_percentage,false).'%'; ?>'>
						<span style="width:<?php echo ($collected_percentage > 100) ? '100%' : $collected_percentage.'%'; ?>;" title = "<?php echo $this->Html->cFloat($collected_percentage,false).'%'; ?>"><?php echo Configure::read('site.currency').$itemDetail['Project']['collected_amount'];?>
						</span>
					</p>
					<p><?php echo Configure::read('site.currency'). $this->Html->cCurrency($itemDetail['Project']['collected_amount']); ?> / <?php echo Configure::read('site.currency'). $this->Html->cCurrency($itemDetail['Project']['needed_amount']); ?></p>

<div class="pledge-list-block clearfix">
	<dl class="deal-discount grid_3 alpha omega"><?php $i = 0; $class = ' class="altrow"';?>
			<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __l('Fund Amount');?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>><?php echo Configure::read('site.currency').$this->Html->cCurrency($itemDetail['ProjectFund']['amount']);?></dd>
            </dl>
               <!--<dl class="deal-discount grid_2 alpha omega">
                        <dt><?php //echo __l('Pledge'); ?> </dt>
							<dd><?php //echo Configure::read('site.currency').$this->Html->cCurrency($itemDetail['ProjectFund']['amount']);?></dd>
                    </dl>-->
                    <dl class="deal-discount grid_2 alpha omega">
						<dt><?php echo __l('Backers'); ?></dt>
							<dd><?php echo $this->Html->cInt($itemDetail['Project']['project_fund_count']); ?></dd>
                    </dl>
    </div>
			</div>
			</div>


	</div>
	             <?php if (!empty($itemDetail['ProjectReward']['id'])): ?>
                        <dl class="select-reward">
							<dt><?php echo __l('Selected reward'); ?> </dt>
							<dd><?php $reward = $itemDetail['ProjectReward']['reward']?$itemDetail['ProjectReward']['reward']:__l('No reward'); echo $this->Html->cText($reward); ?> </dd>
                        </dl>
                        <?php endif; ?>
	</div>
	</div>

    <div class="l-curve-bot">
    	<div class="r-curve-bot">
    		<div class="bot-bg"></div>
    	</div>
    </div>

	
		<?php 				
			echo $this->Form->create('Payment', array('controller' => 'payment', 'action' => 'process_order', 'id' => 'PaymentOrderForm', 'class' => 'normal'));
		?>
  <div class="clearfix paypal-block round-3">
	 <fieldset class="fields-block grid_left suffix_2">
	 <legend><?php echo __l('Payment'); ?></legend>

		<div class="padd-center">
			<?php //echo $this->Form->input('Payment.payment_gateway_id', array('legend' => false, 'type' => 'radio', 'options' => $gateway_options['paymentGateways'], 'class' => 'js-payment-type')); ?>
		</div>


	</fieldset>

	<?php if(false){?>
	<?php if (!empty($gateway_options['paymentGateways'][ConstPaymentGateways::Wallet])): ?>
	<fieldset class="fields-block grid_left js-wallet-connection  <?php echo (!empty($this->request->data['Payment']['payment_gateway_id']) && $this->request->data['Payment']['payment_gateway_id'] == ConstPaymentGateways::Wallet) ? "" : 'hide'?>">
	<legend><?php echo __l('Pledge with Wallet'); ?></legend>
					<div class=" pay-paypa-side1 wallet-side1">
						<?php if(!empty($user_info['User']['available_wallet_amount'])):?>
							<p class="available-balance js-user-available-balance {'balance':'<?php echo $user_info['User']['available_wallet_amount']; ?>'}"><?php echo __l('Your available balance:').' '. Configure::read('site.currency').$user_info['User']['available_wallet_amount'];?></p>
						<?php endif;?>
						<h3><?php echo __l('Pay by Wallet'); ?></h3>
						<div class="clearfix connected-paypal-block">

							<?php
							echo $this->Form->create('Payment', array('controller' => 'payment', 'action' => 'process_order', 'id' => 'PaymentOrderForm', 'class' => 'normal'));
							echo $this->Form->input('item_id', array('type' => 'hidden'));
							echo $this->Form->input('amount', array('type' => 'hidden','value'=>$total_amount));
							echo $this->Form->submit(__l('Pay by Wallet'), array('name' => 'data[Payment][wallet]', 'class' => ' js-update-order-field wallet-button round-5'));?>
						</div>
					</div>		
		</fieldset>
				<?php endif; ?>


	<fieldset class="fields-block grid_left js-paypal-main <?php echo (!empty($this->request->data['Payment']['payment_gateway_id']) && $this->request->data['Payment']['payment_gateway_id'] == ConstPaymentGateways::PayPal) ? "" : 'hide'?>">
		<legend><?php echo __l('Pledge with PayPal'); ?></legend>
		<div class="clearfix">
			<?php 
				echo $this->Form->create('Payment', array('controller' => 'payment', 'action' => 'process_order', 'id' => 'PaymentProcessOrderFormNormal',  'class' => 'normal'));
				echo $this->Form->input('item_id', array('type' => 'hidden'));
				echo $this->Form->input('amount', array('type' => 'hidden','value'=>$total_amount));
				echo $this->Form->submit(__l('Pledge with PayPal'),array('name' => 'data[Payment][paypal]'));
			?>
		</div>
		<p class="order-paypal-info"><?php echo __l('This will take you to the paypal.com'); ?></p>
	</fieldset>
	<?php }?>
	<fieldset class="fields-block grid_left js-NganLuong-main <?php //echo (!empty($this->request->data['Payment']['payment_gateway_id']) && $this->request->data['Payment']['payment_gateway_id'] == ConstPaymentGateways::NganLuong) ? "" : 'hide'?>">
		<legend><?php echo __l('Pledge with NganLuong'); ?></legend>
		<div class="clearfix">
			<?php 
				echo $this->Form->create('Payment', array('controller' => 'payment', 'action' => 'process_order', 'id' => 'PaymentProcessOrderFormNormal',  'class' => 'normal'));
				echo $this->Form->input('item_id', array('type' => 'hidden'));
				echo $this->Form->input('amount', array('type' => 'hidden','value'=>$total_amount));
				echo $this->Form->submit(__l('Pledge with NganLuong'),array('name' => 'data[Payment][paypal]', 'class' => 'nganluong-block'));
			?>
		</div>
		<p class="order-paypal-info"><?php echo __l('This will take you to the NganLuong.vn'); ?></p>
	</fieldset>
	</div>
	<?php echo $this->Form->end(); ?>

</div>
	</div>
							</div>
						</div>
						<div class="l-curve-bot">							
							<div class="r-curve-bot">
								<div class="bot-bg"></div>
							</div>
						</div>
</div>